﻿@page "/"
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@using GMS.NET.Web.Components
@using GMS.NET.Web.Components.Shared.Global.Identity
@using GMS.NET.Web.Components.Shared.Global.Misc
@using Microsoft.AspNetCore.DataProtection
@inject IDataProtectionProvider Protector
@{
    Layout = "_Layout";
    var InitialUser = new InitialUser();
    var cookie = HttpContext.Request.Cookies[ClientAppKey.ServerCookie];
    if (!string.IsNullOrWhiteSpace(cookie))
    {
        var token = Protector.CreateProtector(ClientAppKey.ServerCode).Unprotect(cookie);
        InitialUser = System.Text.Json.JsonSerializer.Deserialize<InitialUser>(token);
    }
}
<component type="typeof(App)" render-mode="ServerPrerendered" param-InitialUser="InitialUser" />
